     import java.io.File;
     import javax.swing.JFileChooser;
   
     public class Arquivos
    {
    	 File caminho = null;
       public File pegarArquivo(String titulo)
       {

          JFileChooser fileChooser = new JFileChooser();
          fileChooser.setDialogTitle(titulo);
          fileChooser.showOpenDialog( null );
             
               caminho = fileChooser.getSelectedFile();
          
          return caminho;
       } 
       public File pegarPasta()
       {

          JFileChooser fileChooser = new JFileChooser(".");
          fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
          fileChooser.showOpenDialog( null );
             
               caminho = fileChooser.getSelectedFile();
          
          return caminho;
       } 
    } 